package lock;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * @author ycz
 * @date 2021/5/26
 *
 */
public class LockTest {

    public void method() {
        synchronized (this) {
            System.out.println("Method 1 start");
        }
    }

    public static void main(String[] args) {
        int s = 1;
        switch (s) {
            case 1:
                System.out.println(123);
                return;
            case 2:
                return;
        }
        System.out.println(456);
    }

    private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
    private final Lock read = readWriteLock.readLock();
    private final Lock write = readWriteLock.writeLock();

}
